<?php
//$numbers = [1, 3, 4, 2, 4, 5, 7];
////print_r($numbers);
////sort($numbers);
//rsort($numbers);
//print_r($numbers);

//$user = [
//    'id' => 1,
//    'name' => '张三',
//    'age' => 30
//];
//// 将数组转化成一般的变量，变量名是索引前面加上$,变量的值为索引的那个值
//extract($user);
//echo $id . '-' . $name . '-' . $age;


//$id = 10002;
//$name = '李四';
//$score = 90;
//// 将一般的变量转换成数组，传递参数是生成数组的索引，值是你给定的索引前面加上$生成变量对应的值
//$user1 = compact('id', 'name', 'score');
//print_r($user1);


//$keys = array_keys($user);
//$values = array_values($user);
//print_r($values);

////ksort($user);
//krsort($user);
//print_r($user);


//$numbers = [1, 2, 3];
////echo in_array(3, $numbers);
//
//if (!in_array(4, $numbers)) {
//    $numbers[] = 4;
//}
//
//print_r($numbers);

$numbers = [1, 2, 3, 4, 4, 3, 1, 5];
//$new_numbers = [];
//foreach($numbers as $val){
//    if (!in_array($val, $new_numbers)) {
//        $new_numbers[] = $val;
//    }
//}
//print_r($new_numbers);
$user = [
    'id' => 1,
    'name' => '张三',
    'age' => 30
];

$users = [
    [
        'id' => 1,
        'name' => '张三',
        'age' => 30
    ],
    [
        'id' => 2,
        'name' => '李四',
        'age' => 30
    ]
];
$count = count($users);
echo $count;